﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Imaginecup.gameState;
using Microsoft.Xna.Framework.Input;
using Imaginecup.recycling.Behavior;
using Imaginecup.recycling.Object.Entity;
using Imaginecup.Recycling.GameMan;
using Imaginecup.shareData;
using Imaginecup.recycling.Object;

namespace Imaginecup.Recycling.Object
{
    public abstract class GameObject : IGameObject
    {
        protected ObjectInfo m_Info;
        protected Direction m_Direction;
        protected string m_TextureName;
        protected IManager m_Manager;
        protected Vector2 m_Velocity;

        private int primaryNumber;


        public void SetManager(IManager manager)
        {
            m_Manager = manager;
        }

        #region Properties
        public Rectangle SourceCollision
        {
            get { return m_Info.WorldRectangle; }
        }
        public int PrimaryNumber
        {
            get { return primaryNumber; }
            set { primaryNumber = value; }
        }
        public Texture2D Texture
        {
            get { return ResourceManager.GetInstance().GetContent(m_TextureName); }
        }

        #endregion

        public GameObject()
        {
            Initialize();
        }

        protected virtual void Initialize() { }
        public virtual void Draw(SpriteBatch spriteBatch, GameTime gametime)
        {
            if (m_Info.WorldLocation.X <= StateShareData.GetShareData().GetGame().GraphicsDevice.Viewport.Width)
            {
                spriteBatch.Begin();
                spriteBatch.Draw(ResourceManager.GetInstance().GetContent(m_TextureName), m_Info.WorldLocation, Color.White);
                spriteBatch.End();

            }
        }
        public virtual void Update(GameTime gameTime){}

        public virtual Texture2D GetTexture()
        {
            return null;
        }

        public void SetPrimaryNumber(int number)
        {
            primaryNumber = number;
        }
    }
}
